<template>
  <!--  个性特征      -->
  <view
    class="allContainer"
    :style="[{ backgroundColor: isShowBgColor ? '#D9E2CC' : '#00000000' }]"
  >
    <view class="maskBox" />
    <image class="textImg" :src="partTextImgUrl" />
    <!-- <view class="imgFloatCenter"></view> -->
    <view :style="[{ paddingRight: '32rpx' }, { paddingLeft: '32rpx' }]">
      <view class="contentBack">
        <view
          :style="[
            { marginTop: '33rpx' },
            { display: 'flex' },
            { alignItems: 'center' },
          ]"
        >
          <!-- <span class="smallTitleGreen">智慧的毕方为你</span>
        <span class="smallTitleRed">传授成功的秘诀</span> -->
          <view class="blackBox"> </view>
          <view>
          <span
            :class="titleItem.color == 1 ? 'smallTitleGreen' : 'smallTitleRed'"
            v-for="(titleItem, titleIndex) in developmentAdvice.title"
            :key="titleIndex"
            >{{ titleItem.label }}</span
          >
          </view>
        </view>

        <view
          v-for="(descListItem, descListIndex) in developmentAdvice.descList"
          :key="descListIndex"
        >
          <view
            class="smallTitleGreenLittle"
            :style="[{ marginTop: '37rpx' }]"
            >{{ descListItem.label }}</view
          >

          <!-- <view class="onePartContent" :style="[{ marginTop: '49rpx' }]">
            <view
              v-for="(valueItem, valueIndex) in descListItem.value"
              :key="valueIndex"
              >·{{ valueItem }}</view
            >
          </view> -->
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  // components: {},
  props: {
    itemIndex: {
      type: Number,
      default: 0,
    },

    isShowBgColor: {
      type: Boolean,
      default: false,
    },

    textImgWidthRpx: {
      type: Number,
      default: 271,
    },

    textImgHeightRpx: {
      type: Number,
      default: 38,
    },

    contentPaddingLeftRpx: {
      type: Number,
      default: 48,
    },

    contentPaddingRightRpx: {
      type: Number,
      default: 200,
    },

    partTextImgUrl: {
      type: String,
      default:
        "https://img3.job1001.com/ypMp/elan/images/career/careerAssessNew/title7.png",
    },

    developmentAdvice: {
      type: Object,
      default() {
        return {
          descList: [
            {
              label:
                "现在你对自己的人格类型和动力已经有了一个比较清楚的了解，但这还不够。",
              value: [
                "测试测试测试测试测试测试测试测试",
                "测试测试测试测试测试测试测试测试",
                "测试测试测试测试测试测试测试测试",
              ],
            },
          ],
          title: [
            {
              color: "1",
              label: "智慧的毕方为你",
            },
            {
              color: "2",
              label: "传授成功的秘诀",
            },
          ],
        };
      },
    },
  },
  data() {
    return {
      currentIndex: 0,
      bottomImg:
        "https://img3.job1001.com/ypMp/elan/images/career/careerAssessNew/bottom.png",
      imgPavilion:
        "https://img3.job1001.com/ypMp/elan/images/career/careerAssessNew/flower.png",
    };
  },
  watch: {
    itemIndex: {
      handler(val) {
        this.currentIndex = val;
      },
      deep: true, // 深度监听
      immediate: true, // 初始化的时候立刻执行一次
    },
  },
  onReady() {},

  mounted() {
    uni
      .createSelectorQuery()
      .in(this)
      .select(".allContainer")
      .boundingClientRect((rect) => {
        console.log("rect.height = " + rect.height);
        this.$emit("listenRect", rect, this.currentIndex);
      })
      .exec();
  },
  methods: {},
};
</script>

<style lang="scss" scoped>
.allContainer {
  position: relative;
  height: 500rpx;
  width: 100%;
  // background-size: 100% auto;
  // background-image: url($img-base + "career/careerAssessResult/bg_part1.png");
  // background-repeat: no-repeat;
  //background-color: #D9E2CC;
  padding-bottom: 30rpx;
}

.maskBox {
  width: 750rpx;
  height: 410rpx;
  position: absolute;
  bottom: 110rpx;
  z-index: 2;
  background-image: linear-gradient(#00000000, #c6d8c0);
}

.contentView {
  z-index: 1;
  position: absolute;
  width: 100%;
  // padding-left: 48rpx;
  // padding-right: 200rpx;
  //  background-size: 380rpx 277rpx;
  // background-image: url($img-base + "career/careerAssessResult/img_pavilion.png");
  // background-repeat: no-repeat;
  //background-position: top right;
}
.contentBack {
  position: relative;
  width: 100%;
  margin-top: -10rpx;
  background: linear-gradient(
    to bottom,
    #bbeaf8 0%,
    #e4f8f2 50rpx,
    #f6f4df 80rpx,
    #f9f7e5 100%
  );
  padding: 20rpx 0 50rpx 0;
  border-radius: 0 15rpx 15rpx 15rpx;
}

.blackBox {
  content: "";
  width: 10rpx;
  max-width: 10rpx;
  height: 38rpx;
  margin-top: 6rpx;
  margin-right: 20rpx;
  background: #000;
  color: #000;
  font-size: 26rpx;
}
.textImg {
  height: 130rpx;
  width: 100%;
  image-rendering: -webkit-optimize-contrast;
  z-index: 9;
  position: relative;
}

.smallTitleGreen {
  font-size: 34rpx;
  font-family: Source Han Sans CN;
  font-weight: bold;
  color: #000;
  //line-height: 120rpx;
}

.smallTitleRed {
  font-size: 34rpx;
  font-family: Source Han Sans CN;
  font-weight: bold;
  color: #ed5c22;
  //	line-height: 120rpx;
}
.imgFloatCenter {
  position: absolute;
  background: url($img-base + "career/careerAssessNew/flower.png");
  width: 100%;
  height: 700rpx;
  background-position: center;
  background-size: 72%;
  background-repeat: no-repeat;
  right: 0rpx;
  bottom: 30rpx;
  z-index: 9;
}
.blueBox {
  width: 26rpx;
  height: 20rpx;
  background: linear-gradient(to right, #76a3ee 0%, #f9f7e5 100%);
  margin-top: 10rpx;
  margin-right: 10rpx;
}
.smallTitleGreenLittle {
  color: #457766;
  font-size: 28rpx;
  font-weight: 600;
  padding: 0 32rpx;
}
.onePartContent {
  font-size: 28rpx;
  //color: #555555;
  margin-top: 47rpx;
  line-height: 37rpx;
  letter-spacing: 0rpx;

  background-clip: text;
  white-space: normal;
  word-break: break-all;

  color: transparent;
  display: -webkit-box;
  background-image: linear-gradient(#555555, #ff000000);
  -webkit-box-orient: vertical;
  /*设置省略号在容器第2行文本后*/
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
}
</style>
